Skip to content

Conversation

stephane-vanraes
Copy link
Contributor

Because this is a common recurring question, this PR adds a touch more information in regards to reactivity and arrays. More specifically the need for an assignment after array manipulation.

This is already covered in the tutorial, but it seems good to also include it as an example directly in the docs themselves.

Copy link
Member

@dummdidumm dummdidumm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thank you! I would move the example what does and what doesnt trigger the update into the existing code block

Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com>
@stephane-vanraes
Copy link
Contributor Author

I am not sure about moving it in the same block, I think keeping them separate avoids confusion because it makes the distinction betweeen the normal way and the special case

Co-authored-by: Geoff Rich <geoff.s.rich@gmail.com>
@benmccann benmccann changed the title Add clarification about reactivity and arrays [docs] Add clarification about reactivity and arrays Jul 20, 2021
// this method call does not trigger an update
arr.push(2);
// this assignment will trigger an update
// if the markup references `arr`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should go on the previous line? it's sort of a short line break. Probably fine either way though

@stephane-vanraes
Copy link
Contributor Author

Fixed the language following Ben's comment.
Moved the array text and sample to their own 'row' so that it's clearer which part of the text belongs to each code block.

@benmccann benmccann merged commit 63f592e into sveltejs:master Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants